<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import="com.meila.cms.util.config.Property"%>
<%
  String path = request.getContextPath();
  String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
 
%>
<!DOCTYPE HTML>
<html lang="zh-CN">
  <head>
    <base href="<%=basePath%>">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>企业认证</title>
    
 
  </head>
  
  <body class="console-body">
      
       <jsp:include page="../common/console.jsp"></jsp:include>
  
  	<div class="console-list">
  		<div class="console-listSolid">&nbsp;</div>
  		<div class="approve-formContent">
  			<form action="" method="post">
  				<div class="approve-title">企业用户认证</div>
				<ul class="approve-contentBox af-contentBox">
					<li><span>手机号：</span>${userModel.phone}</li>
					<li><span>公司名称：</span>${userModel.name}</li>
					<li><span>公司地址：</span>${userModel.site}</li>
					<li><span>联系人：</span>${userModel.contacts}</li>
					<li><span>公司固话：</span>${userModel.fixedtel}</li>  	 
					<li><span>成立时间：</span><fmt:formatDate type="both"    value="${userModel.establishmentDate}" /></li>
					<li><span>公司规模：</span>${userModel.scaleValue}</li>
					<li><span>营业执照：</span><div class="approve-imgBox"><img src="<%=Property.getProperty("FILESERVER_PATH") %>?id=${userModel.license}"/></div></li>
				</ul>
				<c:if test="${param.task!='view'}">
					<ul class="approve-btnBar">
						<li><a class="btn approve-btn" href="after/user/approve_user_list" role="button">返回</a></li>
					    <li><a id="ap-nopassBtn" class="btn approve-btn" href="javascript:;" role="button">认证不通过</a></li>
					    <li><a class="btn approve-btn" href="javascript:authentication(${userModel.id},1,null);" role="button">认证通过</a></li>
					</ul>
				 </c:if>
  			</form>
  		</div>
  	</div>
  	
	<!-- Modal -->
	<div class="modal fade bs-example-modal-sm" id="ap-nopassModal" tabindex="-1" role="dialog" aria-labelledby="ap-nopassModalLabel" data-backdrop="static">
	  <div class="modal-dialog modal-sm" role="document">
 
		    <div class="modal-content">
		      <div class="modal-header">
		        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
		        <h4 class="modal-title" id="myModalLabel">审核理由</h4>
		      </div>
		      
		      <div class="modal-body console-modalBody">
		        <textarea placeholder="不通过的理由..." cols="34" rows="5" id="reason"></textarea>
		      </div>
		      
			      <div class="modal-footer">
			        <button type="button" class="btn btn-default" data-dismiss="modal" onclick="window.location.href=after/user/approve_user_list">取消</button>
			        <button type="button" class="btn btn1" onclick="authentication('${userModel.id}',2,$('#reason').val())">确定</button>
			      </div>
		   
		    </div>
 
	  </div>
	</div>
	
	
	<script type="text/javascript">
		$(document).ready(function(){
			modalSwitch();
		});
		
		function modalSwitch(){
			$("#ap-nopassBtn").click(function(){
				$("#ap-nopassModal").modal('show');
			});
		}
		
		
	    function authentication(id,authentication,reason){
		
			    	 $.ajax({
					     type: 'get',
					     url:  '<%=basePath %>/after/user/updateAuthentication', 
						 data: {"reason":reason,"authentication":authentication,"id":id},
						 dataType: 'json',
						 success: function(data) {  
			                if(data.result){
			                
			                    jAlert(data.msg,'提示', function() {
								  window.location.href='<%=basePath %>/after/user/approve_user_list';
								});
			                }else{
			                	jAlert(data.msg,'提示');
			                }
		
			            }
						
					 });
		
		}
	</script>
	
  </body>
</html>
